# Contributor:...

pkgname=tvheadend-svn
pkgver=4941
pkgrel=1
pkgdesc="Tvheadend: TV streaming server"
arch=('i686' 'x86_64')
url="http://www.lonelycoder.com/hts/"
license=('GPL3')
depends=('avahi')
makedepends=('gzip')
optdepends=('xmltv: For an alternative source of programme listings')
install=tvheadend.install
source=(
        rc-tvheadend
        tvheadend.install
        )
md5sums=(
        '3734a55eb44a59a3c9a12ec3f0a593bf'
        '7b62665c7b661c73619a3007193a4a0b'
        )



_prefix=/usr

build() {
    _svntrunk=svn://svn.lonelycoder.com/hts/trunk/tvheadend
    _svnmod=Tvheadend

    cd ${srcdir}/
    if [ -d $_svnmod/.svn ]; then
        (cd $_svnmod && svn up -r $pkgver) || return 1
    else
        svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod || return 1
    fi
    msg "SVN checkout done or server timeout"
    msg "Starting make..."

    cp -r "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
    cd "$srcdir/$_svnmod-build" 



    msg "Running make" 

    ./configure --prefix=${_prefix} --release || return 1

    make || return 1

    # make DESTDIR=${pkgdir} install
    install -D -m755 build.Linux/tvheadend ${pkgdir}/usr/bin/tvheadend || return 1

    # Install rc-script
    install -D -m755 ${srcdir}/rc-tvheadend ${pkgdir}/etc/rc.d/tvheadend || return 1

}
